package cn.sofwin.project.src.entity;

import cn.sofwin.project.src.service.NetService;

// 网虫套餐
public class NetPackage extends ServicePackage implements NetService {
    // 流量
    public double flow = 5;

    public void showInfo(){
        System.out.println("上网流量:" + flow + "GB");
    }
    // 使用流量
    public void netPlay(double floww, MobileCard card){
        this.flow -= floww;
        // 超过套餐的消费
        if(this.flow <= 0){
            card.consumAmount += 0.2 * (floww - this.flow);
            card.money -= card.consumAmount;
            this.flow = 0;
        }
        card.realFlow += floww;
    }

}
